.class Lcom/hyphenate/chat/EMClient$6;
.super Ljava/lang/Object;

# interfaces
.implements Ljava/lang/Runnable;


# instance fields
.field final synthetic this$0:Lcom/hyphenate/chat/EMClient;

.field final synthetic val$autoLogin:Z

.field final synthetic val$callback:Lcom/hyphenate/EMCallBack;

.field final synthetic val$password:Ljava/lang/String;

.field final synthetic val$username:Ljava/lang/String;


# direct methods
.method constructor <init>(Lcom/hyphenate/chat/EMClient;Ljava/lang/String;Lcom/hyphenate/EMCallBack;ZLjava/lang/String;)V
    .locals 0

    iput-object p1, p0, Lcom/hyphenate/chat/EMClient$6;->this$0:Lcom/hyphenate/chat/EMClient;

    iput-object p2, p0, Lcom/hyphenate/chat/EMClient$6;->val$username:Ljava/lang/String;

    iput-object p3, p0, Lcom/hyphenate/chat/EMClient$6;->val$callback:Lcom/hyphenate/EMCallBack;

    iput-boolean p4, p0, Lcom/hyphenate/chat/EMClient$6;->val$autoLogin:Z

    iput-object p5, p0, Lcom/hyphenate/chat/EMClient$6;->val$password:Ljava/lang/String;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method


# virtual methods
.method public run()V
    .locals 4

    iget-object v0, p0, Lcom/hyphenate/chat/EMClient$6;->val$username:Ljava/lang/String;

    if-nez v0, :cond_1

    iget-object v0, p0, Lcom/hyphenate/chat/EMClient$6;->val$callback:Lcom/hyphenate/EMCallBack;

    const/16 v1, 0x65

    const-string/jumbo v2, "Invalid user name"

    invoke-interface {v0, v1, v2}, Lcom/hyphenate/EMCallBack;->onError(ILjava/lang/String;)V

    :cond_0
    :goto_0
    return-void

    :cond_1
    new-instance v0, Lcom/hyphenate/chat/adapter/EMAError;

    invoke-direct {v0}, Lcom/hyphenate/chat/adapter/EMAError;-><init>()V

    iget-boolean v1, p0, Lcom/hyphenate/chat/EMClient$6;->val$autoLogin:Z

    if-eqz v1, :cond_3

    iget-object v1, p0, Lcom/hyphenate/chat/EMClient$6;->this$0:Lcom/hyphenate/chat/EMClient;

    invoke-virtual {v1}, Lcom/hyphenate/chat/EMClient;->onNewLogin()V

    iget-object v1, p0, Lcom/hyphenate/chat/EMClient$6;->this$0:Lcom/hyphenate/chat/EMClient;

    # getter for: Lcom/hyphenate/chat/EMClient;->emaObject:Lcom/hyphenate/chat/adapter/EMAChatClient;
    invoke-static {v1}, Lcom/hyphenate/chat/EMClient;->access$000(Lcom/hyphenate/chat/EMClient;)Lcom/hyphenate/chat/adapter/EMAChatClient;

    move-result-object v1

    iget-object v2, p0, Lcom/hyphenate/chat/EMClient$6;->val$username:Ljava/lang/String;

    iget-object v3, p0, Lcom/hyphenate/chat/EMClient$6;->val$password:Ljava/lang/String;

    invoke-virtual {v1, v2, v3, v0}, Lcom/hyphenate/chat/adapter/EMAChatClient;->autoLogin(Ljava/lang/String;Ljava/lang/String;Lcom/hyphenate/chat/adapter/EMAError;)V

    invoke-virtual {v0}, Lcom/hyphenate/chat/adapter/EMAError;->errCode()I

    move-result v1

    if-nez v1, :cond_2

    iget-object v1, p0, Lcom/hyphenate/chat/EMClient$6;->this$0:Lcom/hyphenate/chat/EMClient;

    invoke-virtual {v1}, Lcom/hyphenate/chat/EMClient;->checkPushAvailable()V

    iget-object v1, p0, Lcom/hyphenate/chat/EMClient$6;->val$callback:Lcom/hyphenate/EMCallBack;

    invoke-interface {v1}, Lcom/hyphenate/EMCallBack;->onSuccess()V

    :goto_1
    invoke-virtual {v0}, Lcom/hyphenate/chat/adapter/EMAError;->errCode()I

    move-result v0

    const/16 v1, 0xca

    if-ne v0, v1, :cond_0

    invoke-static {}, Lcom/hyphenate/chat/EMSessionManager;->getInstance()Lcom/hyphenate/chat/EMSessionManager;

    move-result-object v0

    invoke-virtual {v0}, Lcom/hyphenate/chat/EMSessionManager;->clearLastLoginPwd()V

    goto :goto_0

    :cond_2
    iget-object v1, p0, Lcom/hyphenate/chat/EMClient$6;->val$callback:Lcom/hyphenate/EMCallBack;

    invoke-virtual {v0}, Lcom/hyphenate/chat/adapter/EMAError;->errCode()I

    move-result v2

    invoke-virtual {v0}, Lcom/hyphenate/chat/adapter/EMAError;->errMsg()Ljava/lang/String;

    move-result-object v3

    invoke-interface {v1, v2, v3}, Lcom/hyphenate/EMCallBack;->onError(ILjava/lang/String;)V

    goto :goto_1

    :cond_3
    iget-object v1, p0, Lcom/hyphenate/chat/EMClient$6;->this$0:Lcom/hyphenate/chat/EMClient;

    # getter for: Lcom/hyphenate/chat/EMClient;->emaObject:Lcom/hyphenate/chat/adapter/EMAChatClient;
    invoke-static {v1}, Lcom/hyphenate/chat/EMClient;->access$000(Lcom/hyphenate/chat/EMClient;)Lcom/hyphenate/chat/adapter/EMAChatClient;

    move-result-object v1

    iget-object v2, p0, Lcom/hyphenate/chat/EMClient$6;->val$username:Ljava/lang/String;

    iget-object v3, p0, Lcom/hyphenate/chat/EMClient$6;->val$password:Ljava/lang/String;

    invoke-virtual {v1, v2, v3, v0}, Lcom/hyphenate/chat/adapter/EMAChatClient;->login(Ljava/lang/String;Ljava/lang/String;Lcom/hyphenate/chat/adapter/EMAError;)V

    invoke-virtual {v0}, Lcom/hyphenate/chat/adapter/EMAError;->errCode()I

    move-result v1

    if-nez v1, :cond_4

    invoke-static {}, Lcom/hyphenate/chat/EMSessionManager;->getInstance()Lcom/hyphenate/chat/EMSessionManager;

    move-result-object v1

    iget-object v2, p0, Lcom/hyphenate/chat/EMClient$6;->val$username:Ljava/lang/String;

    invoke-virtual {v1, v2}, Lcom/hyphenate/chat/EMSessionManager;->setLastLoginUser(Ljava/lang/String;)V

    invoke-static {}, Lcom/hyphenate/chat/EMSessionManager;->getInstance()Lcom/hyphenate/chat/EMSessionManager;

    move-result-object v1

    iget-object v2, p0, Lcom/hyphenate/chat/EMClient$6;->val$password:Ljava/lang/String;

    invoke-virtual {v1, v2}, Lcom/hyphenate/chat/EMSessionManager;->setLastLoginPwd(Ljava/lang/String;)V

    iget-object v1, p0, Lcom/hyphenate/chat/EMClient$6;->this$0:Lcom/hyphenate/chat/EMClient;

    invoke-virtual {v1}, Lcom/hyphenate/chat/EMClient;->onNewLogin()V

    iget-object v1, p0, Lcom/hyphenate/chat/EMClient$6;->this$0:Lcom/hyphenate/chat/EMClient;

    invoke-virtual {v1}, Lcom/hyphenate/chat/EMClient;->checkPushAvailable()V

    iget-object v1, p0, Lcom/hyphenate/chat/EMClient$6;->val$callback:Lcom/hyphenate/EMCallBack;

    invoke-interface {v1}, Lcom/hyphenate/EMCallBack;->onSuccess()V

    goto :goto_1

    :cond_4
    iget-object v1, p0, Lcom/hyphenate/chat/EMClient$6;->this$0:Lcom/hyphenate/chat/EMClient;

    invoke-virtual {v1}, Lcom/hyphenate/chat/EMClient;->doStopService()V

    iget-object v1, p0, Lcom/hyphenate/chat/EMClient$6;->val$callback:Lcom/hyphenate/EMCallBack;

    invoke-virtual {v0}, Lcom/hyphenate/chat/adapter/EMAError;->errCode()I

    move-result v2

    invoke-virtual {v0}, Lcom/hyphenate/chat/adapter/EMAError;->errMsg()Ljava/lang/String;

    move-result-object v3

    invoke-interface {v1, v2, v3}, Lcom/hyphenate/EMCallBack;->onError(ILjava/lang/String;)V

    goto :goto_1
.end method
